<?php $this->headScript()->appendFile($this->JS_PATH . 'contractorlisting.js'); ?>
<div id="contractor-listing"></div>
<div id="MainContent">
    <div class="pagemcontainer">
	<?php echo $this->flashmessages();?>
	<?php if(count($this->errorMessage) > 0):?>
    <div class="pageerrorcontainer">
    <?php foreach($this->errorMessage as $_value):?>
	    <div class="pageoverflow">
		<img src="<?php echo $this->IMAGE_PATH; ?>icons/system/stop.gif" class="systemicon" alt="Error" title="Error" />
		<label class="errorlabel"><?php echo $_value; ?></label>
	    </div>
    <?php endforeach;?>
    </div>
    <?php endif; ?>

    <?php if ($this->successmessage != ''): ?>
        <div class="pagemcontainer">
    	<p class="pagemessage">
    	    <img src="<?php echo $this->IMAGE_PATH; ?>icons/system/accept.gif" class="systemicon" alt="Success" title="Success" />
    	    <label class="errorlabel"><?php echo $this->successmessage; ?></label>
    	</p>
        </div>
    <?php endif; ?>

		        <div class="pagecontainer">
		    	<div class="pageoverflow">
		    	    <div class="pageheader">Contractor Listing</div>
		    	</div>
		    	<div id="contentlist">
		    	    <form action="" method="post" id="contractorlistingfrm">
		    		<div class="pageoptions">
		    		    <div style="margin-top: 0;" class="search-list">
					Search With Selected:&nbsp;&nbsp;
		    			<select name="searchtype" id="searchtype">
		    			    <option value="">All</option>
		    			    <option value="ctr_name" <?php echo ($this->searchtype == "ctr_name") ? "selected" : ""; ?> >Name</option>
		    			    <option value="lgn_email" <?php echo ($this->searchtype == "lgn_email") ? "selected" : ""; ?> >Email</option>
					    <option value="ctr_companyname" <?php echo ($this->searchtype == "ctr_companyname") ? "selected" : ""; ?> >Company name</option>
                                            <option value="lgn_active" <?php echo ($this->searchtype == "lgn_active") ? "selected" : ""; ?> >Status</option>
					    <?php /*?><option value="daterange" <?php echo ($this->searchtype == "daterange") ? "selected" : ""; ?> >Created Date</option> <?php */?>
					</select>
			<span id="searchtext-container" class="display-none search-type">
			    <input type="text" class="search" name="searchtext" id="searchtext" value="<?php echo $this->searchtext; ?>" />
			</span>
                                        
                        <span id="status-container" class="display-none search-type" >
			    <select name="searchstatus" id="search-status">
				<?php foreach ($this->statusArray as $_key => $_value): ?>
    				<option value="<?php echo $_key; ?>" <?php echo ($this->searchstatus == $_key) ? "selected" : ""; ?> ><?php echo $_value; ?></option>
				<?php endforeach; ?>
    			    </select>
    			</span>     

			<span id="daterange-container" class="display-none search-type">
			    From: <input type="text" class="search-date" name="datefrom" id="datefrom" value="<?php echo $this->datefrom; ?>" />
			    To: <input type="text" class="search-date" name="dateto" id="dateto" value="<?php echo $this->dateto; ?>" />
			</span>
				<div class="btn-right">
    			<input type="submit" value="Submit" name="submit"/>
    			<input type="submit"  id="show_all_button" value="Show All" name="showall"/>
				<div>
    		    </div>
    		</div>
			<div class="table-overflow">
    		<table cellspacing="0" class="pagetable tablesorter">
    		    <thead>
    			<tr>
    			    <th title="Select All/Select None" class="checkbox" width="1%">
    				<input id="selectall" type="checkbox"/>
    			    </th>

    			    <th title="Name" class="center-th" width="9%">
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_name', 'sort' => 'asc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_up.gif" class="systemicon" alt="Ascending" title="Ascending" /></a>
				    Name
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_name', 'sort' => 'desc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_down.gif" class="systemicon" alt="Descending" title="Descending" /></a>
			    </th>
    			    <th title="Email" class="center-th" width="6%">
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'lgn_email', 'sort' => 'asc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_up.gif" class="systemicon" alt="Ascending" title="Ascending" /></a>
				    Email
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'lgn_email', 'sort' => 'desc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_down.gif" class="systemicon" alt="Descending" title="Descending" /></a>
			    </th>
    			    <th title="Company Name" class="center-th" width="8%">
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_companyname', 'sort' => 'asc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_up.gif" class="systemicon" alt="Ascending" title="Ascending" /></a>
				    Company Name
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_companyname', 'sort' => 'desc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_down.gif" class="systemicon" alt="Descending" title="Descending" /></a>
			    </th>
    			    
    			    <th title="Mobile" class="center-th" width="10%">
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_mobile', 'sort' => 'asc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_up.gif" class="systemicon" alt="Ascending" title="Ascending" /></a>
				    Mobile
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'ctr_mobile', 'sort' => 'desc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_down.gif" class="systemicon" alt="Descending" title="Descending" /></a>
			    </th>
                            <th title="Status" class="center-th" width="8%">
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'lgn_active', 'sort' => 'asc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_up.gif" class="systemicon" alt="Ascending" title="Ascending" /></a>
				    Status
				<a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'list', 'field' => 'lgn_active', 'sort' => 'desc'), 'default', false); ?>"><img src="<?php echo $this->IMAGE_PATH; ?>icons/system/sort_down.gif" class="systemicon" alt="Descending" title="Descending" /></a>
			    </th>
    			    <th class="center-th" width="4%">Edit</th>
    			    <th class="center-th" width="4%">Delete</th>
    			</tr>
    		    </thead>

    		    <tbody>
			<?php if (count($this->contractorsData) > 0): ?>
			<?php $counter = 0; ?>
			<?php foreach ($this->contractorsData as $key => $value) : ?>
			
			<?php if (($counter % 2 ) == "0") : ?>
                        <tr class="row1" onmouseout="this.className='row1';" onmouseover="this.className='row1hover';" >
			<?php else : ?>
                        <tr class="row2" onmouseout="this.className='row2';" onmouseover="this.className='row2hover';">
		    <?php endif; ?>

                            <td class="checkbox" >
                                <input type="checkbox" class="content-checkbox" name="multicheck[]" value="<?php echo $value["ctr_id"]; ?>"/>
                            </td>
                            <td class="center-th"><a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'form', 'ctr_id' => $value["ctr_id"]), null, true); ?>"><?php echo $value["ctr_name"] ?></a></td>
                            <td class="center-th"><?php echo $value['lgn_email'] ?></td>
                            <td class="center-th"><?php echo $value["ctr_companyname"] ?></td>
                            <td class="center-th"><?php echo $value["ctr_mobile"] ?></td>
                            <td class="center-th"><?php echo $this->statusArray[$value["lgn_active"]]; ?></td>
                            <td class="pagepos">
                                <a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'form', 'ctr_id' => $value["ctr_id"]), null, true); ?>">
                                <img src="<?php echo $this->IMAGE_PATH; ?>icons/system/edit.gif" class="systemicon" alt="Edit" title="Edit" />
                                </a>
                            </td>
                            <td class="pagepos">
                                <a href="<?php echo $this->url(array('controller' => 'contractor', 'action' => 'delete', 'ctr_id' => $value["ctr_id"]), null, true); ?>">
                                <img src="<?php echo $this->IMAGE_PATH; ?>icons/system/false.gif" class="systemicon" alt="Delete" title="Delete" />
                                </a>
                            </td>
                        </tr>
		    <?php $counter++; ?>
		    <?php endforeach; ?>
		    <?php else: ?>
                    <tr class="row2" onmouseout="this.className='row2';" onmouseover="this.className='row2hover';">
                        <td>&nbsp;</td>
                        <td colspan="6">No Records Found</td>
                    </tr>
		    <?php endif; ?>
                </tbody>
                </table>
				</div>
                <div class="pageoptions">
                    <div style="margin-top: 0; float: right; text-align: right">
                    With Selected:&nbsp;&nbsp;
                            <select name="multiaction" id="multiaction">
                                    <option value="">none</option>
                                    <option value="delete" <?php echo ("delete" == "delete")?"selected":""; ?> >Delete</option>
                            </select>
                            <input type="submit" accesskey="s" value="Submit"/>
                    </div>
                </div>     
	    
                <div class="paging">
                    <div>
                    <?php echo $this->paginator->displayPages(); ?>
                    </div>
                </div>
                <div class="clearb"></div>
                </form>
    </div>
</div>
<p class="pageback">
    <a class="pageback" href="<?php echo $this->url(array('controller' => 'index', 'action' => 'index',), null, true); ?>">
    &#171; Back to Home
    </a>
</p>
<div class="clearb"></div>
</div>
</div>